import {WidgetClass} from "./widget";
import {WidgetFactory} from "@/modules/IDE/widgetFactory";
export class WidgetDragLayout extends WidgetClass {
  constructor(options = {}) {
    super(options);
    const {ports, UI} = options;
    if (UI) {
      this.UI.data = UI.data;
    } else {
      this.UI.data = {
        // 水平间距、垂直间距、行数、格子宽高
        config: {
          marginX: 10,
          marginY: 10,
          lineNum: 8,
          xWidth: 6,
          yHeight: 6
        },
        dragChildren:[]
      };
    }

    if (ports) {
      this.ports = ports;
    } else {
      this.ports = this.assembleDefaultPorts();
    }
  }

  assembleDefaultState(options = {}) {
    const superState = super.assembleDefaultState(options);
    return {
      ...superState,
    };
  }

  assembleDefaultPorts() {
    const superState = super.assembleDefaultPorts();
    return {
      ...superState,
      values: [
       ...superState.values,
      ],
      events: [],
    };
  }
}
